< previous page page_267 next page >

Page 267
0267-01.jpg
Figure 9.12
Program Scenes showing a partially
completed random tile over.
e10a6a0a59f035e870d90cca05b85fce.gif
Dim chunk_row() As Integer
Dim chunk_col() As Integer
Dim num_chunks As Integer
Dim chunk As Integer
Dim i As Integer
Dim j As Integer
Dim tmp As Integer

    ' Prevent more than one wipe at a time.
    If Wiping Then Exit Sub
    Wiping = True

    ' Allocate the chunk_row and chunk_col arrays.
    num_chunks = divisions_per_side * divisions_per_side
    ReDim chunk_row(1 To num_chunks)
    ReDim chunk_col(1 To num_chunks)

    ' Put the row and column numbers in the
    ' chunk_row and chunk_col arrays.
    chunk = 1
    For i = 1 To divisions_per_side
        For j = 1 To divisions_per_side
            chunk_row(chunk) = i - 1
            chunk_col(chunk) = j - 1
            chunk = chunk + 1
        Next j
    Next i

    ' Randomize the chunks.
    For i = 1 To num_chunks - 1
        ' Pick a random entry between i
        ' and divisions_per_side.

 
< previous page page_267 next page >